home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / asm / alib11b.zip / CODE1.ZIP / DISKINFO / DRV_AB.ASM next >
Assembly Source File  |  1994-10-04  |  2KB  |  55 lines

  1. ;
  2. ;       This module tells if drive A or B should be accessed.
  3. ;
  4.  
  5.         PUBLIC          _drive_ab_present
  6. _drive_ab_present       PROC FAR
  7.         push    bp
  8.         mov     bp,sp
  9.         push    es
  10.         push    bx
  11.         push    cx
  12.         int     11h
  13.         test    al,1                    ; floppies present?
  14.         jz      dab_exit_1              ; no so always report 'go for it'
  15.         mov     cl,6
  16.         shr     al,cl
  17.         and     al,3                    ; al==nbr drives per BIOS-1
  18.         inc     al                      ; al==nbr drives per BIOS
  19.         cmp     al,1                    ; if drives!=1, report 'go for it'
  20.         jne     dab_exit_1              ; if don't branch, 1 floppy present
  21.         mov     bx,[bp+6]               ; bx=input arg from caller
  22.         xor     ax,ax                   ; al=0
  23.         or      bx,bx                   ; input arg is 0?
  24.         jz      dab_wants_a             ; yes, 0, so drive desired is 0
  25.         inc     ax                      ; al=1
  26. dab_wants_a:
  27.                                         ; now al 0 if checking A, 0FFh if
  28.                                         ; user is checking B
  29.         xor     bx,bx
  30.         mov     es,bx
  31.         mov     bx,504h
  32.         mov     ah,es:[bx]              ; get DOS a_b floppy var
  33.                                         ; now ah 0 if real drive is now
  34.                                         ; acting as A, 1 if B
  35.  
  36. ;       now we test AH against AL.  if AH==AL, user wants to know
  37. ;       about the drive that IS present.  If AH!=AL, user is
  38. ;       checking the phantom drive.
  39.  
  40.         cmp     al,ah
  41.         je      dab_exit_1              ; equal, so present
  42.                                         ; otherwise fall through, not present
  43. dab_exit_0:
  44.         xor     ax,ax
  45.         jmp     SHORT dab_quit
  46. dab_exit_1:
  47.         mov     ax,1
  48. dab_quit:
  49.         pop     cx
  50.         pop     bx
  51.         pop     es
  52.         pop     bp
  53.         ret
  54. _drive_ab_present       ENDP
  55.